package com.bing.bean.weixin;

import com.bing.utils.EventTypeAdapter;
import com.bing.utils.MsgTypeAdapter;
import com.bing.utils.StringDataAdapter;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

/**
 * Created by kaibb on 2014/12/3.
 */

@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)
public class RequestMessage {

    @XmlJavaTypeAdapter(StringDataAdapter.class)
    @XmlElement(name = "URL")
    private String url;
    // 开发者微信号

    @XmlJavaTypeAdapter(StringDataAdapter.class)
    @XmlElement(name = "ToUserName")
    private String toUserName;
    // 发送方帐号（一个OpenID）
    @XmlJavaTypeAdapter(StringDataAdapter.class)
    @XmlElement(name = "FromUserName")
    private String fromUserName;
    // 消息创建时间 （整型）
    @XmlElement(name = "CreateTime")
    private Long createTime;
    // 消息类型（text/image/location/link）
    @XmlJavaTypeAdapter(MsgTypeAdapter.class)
    @XmlElement(name = "MsgType")
    private MsgType msgType;
    // 消息id，64位整型
    @XmlElement(name = "MsgId")
    private Long msgId;

    @XmlJavaTypeAdapter(StringDataAdapter.class)
    @XmlElement(name = "Content")
    private String content;
    @XmlJavaTypeAdapter(StringDataAdapter.class)
    @XmlElement(name = "PicUrl")
    private String picUrl; //图片链接

    @XmlJavaTypeAdapter(StringDataAdapter.class)
    @XmlElement(name = "MediaId")
    private String mediaId;//图片消息媒体id，可以调用多媒体文件下载接口拉取数据。
    @XmlJavaTypeAdapter(StringDataAdapter.class)
    @XmlElement(name = "Format")
    private String format; //语音格式，如amr，speex等
    @XmlElement(name = "ThumbMediaId")
    @XmlJavaTypeAdapter(StringDataAdapter.class)
    private String thumbMediaId; //视频消息缩略图的媒体id，可以调用多媒体文件下载接口拉取数据。

    @XmlElement(name = "Location_X")
    private Float location_X; //地理位置维度

    @XmlElement(name = "Location_Y")
    private Float location_Y; //地理位置经度
    @XmlElement(name = "Scale")
    private Integer scale;//地图缩放大小

    @XmlJavaTypeAdapter(StringDataAdapter.class)
    @XmlElement(name = "Label")
    private String label; //地理位置信息
    @XmlJavaTypeAdapter(StringDataAdapter.class)
    @XmlElement(name = "Title")
    private String title;//消息标题
    @XmlJavaTypeAdapter(StringDataAdapter.class)
    @XmlElement(name = "Description")
    private String description;//消息描述
    @XmlJavaTypeAdapter(EventTypeAdapter.class)
    @XmlElement(name = "Event")
    private EventType event;//事件类型
    @XmlJavaTypeAdapter(StringDataAdapter.class)
    @XmlElement(name = "EventKey")
    private String eventKey;//事件KEY值，qrscene_为前缀，后面为二维码的参数值
    @XmlJavaTypeAdapter(StringDataAdapter.class)
    @XmlElement(name = "Ticket")
    private String ticket; //二维码的ticket，可用来换取二维码图片
    @XmlElement(name = "Latitude")
    private Float latitude; //地理位置纬度
    @XmlElement(name = "Longitude")
    private Float longitude;//地理位置经度
    @XmlElement(name = "Precision")
    private Float precision;//地理位置精度

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getToUserName() {
        return toUserName;
    }

    public void setToUserName(String toUserName) {
        this.toUserName = toUserName;
    }

    public String getFromUserName() {
        return fromUserName;
    }

    public void setFromUserName(String fromUserName) {
        this.fromUserName = fromUserName;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public MsgType getMsgType() {
        return msgType;
    }

    public void setMsgType(MsgType msgType) {
        this.msgType = msgType;
    }

    public Long getMsgId() {
        return msgId;
    }

    public void setMsgId(Long msgId) {
        this.msgId = msgId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getPicUrl() {
        return picUrl;
    }

    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl;
    }

    public String getMediaId() {
        return mediaId;
    }

    public void setMediaId(String mediaId) {
        this.mediaId = mediaId;
    }

    public String getFormat() {
        return format;
    }

    public void setFormat(String format) {
        this.format = format;
    }

    public String getThumbMediaId() {
        return thumbMediaId;
    }

    public void setThumbMediaId(String thumbMediaId) {
        this.thumbMediaId = thumbMediaId;
    }

    public Float getLocation_X() {
        return location_X;
    }

    public void setLocation_X(Float location_X) {
        this.location_X = location_X;
    }

    public Float getLocation_Y() {
        return location_Y;
    }

    public void setLocation_Y(Float location_Y) {
        this.location_Y = location_Y;
    }

    public Integer getScale() {
        return scale;
    }

    public void setScale(Integer scale) {
        this.scale = scale;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public EventType getEvent() {
        return event;
    }

    public void setEvent(EventType event) {
        this.event = event;
    }

    public String getEventKey() {
        return eventKey;
    }

    public void setEventKey(String eventKey) {
        this.eventKey = eventKey;
    }

    public String getTicket() {
        return ticket;
    }

    public void setTicket(String ticket) {
        this.ticket = ticket;
    }

    public Float getLatitude() {
        return latitude;
    }

    public void setLatitude(Float latitude) {
        this.latitude = latitude;
    }

    public Float getLongitude() {
        return longitude;
    }

    public void setLongitude(Float longitude) {
        this.longitude = longitude;
    }

    public Float getPrecision() {
        return precision;
    }

    public void setPrecision(Float precision) {
        this.precision = precision;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("RequestMsg{");
        sb.append("url='").append(url).append('\'');
        sb.append(", toUserName='").append(toUserName).append('\'');
        sb.append(", fromUserName='").append(fromUserName).append('\'');
        sb.append(", createTime=").append(createTime);
        sb.append(", msgType=").append(msgType);
        sb.append(", msgId=").append(msgId);
        sb.append(", content='").append(content).append('\'');
        sb.append(", picUrl='").append(picUrl).append('\'');
        sb.append(", mediaId='").append(mediaId).append('\'');
        sb.append(", format='").append(format).append('\'');
        sb.append(", thumbMediaId='").append(thumbMediaId).append('\'');
        sb.append(", location_X=").append(location_X);
        sb.append(", location_Y=").append(location_Y);
        sb.append(", scale=").append(scale);
        sb.append(", label='").append(label).append('\'');
        sb.append(", title='").append(title).append('\'');
        sb.append(", description='").append(description).append('\'');
        sb.append(", event=").append(event);
        sb.append(", eventKey='").append(eventKey).append('\'');
        sb.append(", ticket='").append(ticket).append('\'');
        sb.append(", latitude=").append(latitude);
        sb.append(", longitude=").append(longitude);
        sb.append(", precision=").append(precision);
        sb.append('}');
        return sb.toString();
    }
}
